
import bpy


from 节点.全局控制.Node.节点和插座基类 import bl_节点基类
from 节点.Core import bl_UI配色

import engine.initLIB.load_dll as engineLib
import ctypes





class C_Node_曲线采样数据(bl_节点基类.C_Node_基类):
	bl_dname = 'bl_node_曲线采样数据'
	bl_label = '曲线采样数据'
	
	m_网格拆分方式类型 = bpy.props.EnumProperty(items=E_网格拆分方式类型枚举, name="类型", default="TYPE_逐面", update=f_update_网格拆分方式类型枚举)
	def init(self, context):
		super(C_Node_曲线采样数据, self).f_init(context)
		self.inputs.new('C_Socket_F32_Array1D', name='inData')
		self.inputs.new('C_Socket_uVec2', name='映射区间')
		
		self.outputs.new('C_Socket_F32_Array1D', name='outData')
		
		self.use_custom_color = True
		self.color = bl_UI配色.g_内部节点颜色
		
		self.f_toCPP();

	def draw_buttons(self, context, layout):
		layout.prop(self, 'm_网格拆分方式类型')
		
	def f_toCPP(self):
		engineLib.flexCAPI.f_创建网格分裂修改器节点(ctypes.c_wchar_p(self.id_data.name), ctypes.c_wchar_p(self.name), self.f_getPyObject());
		


class C_NODE_MENU_曲线生成(bpy.types.Operator):
	bl_idname = 'node.global_node_obj_curve_generation'
	bl_label = '曲线采样数据'
	bl_options = {'REGISTER', 'UNDO'}
	def execute(operator, context):
		bpy.ops.node.add_node(type='C_Node_曲线采样数据', use_transform=True)
		return {'FINISHED'}



















classes = (
	C_Node_曲线生成,
	C_NODE_MENU_曲线生成,
)

def register():
	for c in classes:
		bpy.utils.register_class(c)
		
def unregister():
	for c in classes:
		bpy.utils.unregister_class(c)








